<template>
<!-- 将公共的底部导航栏 单独封装  避免造轮子 -->
    <van-tabbar v-model="tabActive">
      <van-tabbar-item icon="home-o" to='/'>首页</van-tabbar-item>
      <van-tabbar-item icon="label-o" to="/topic">专题</van-tabbar-item>
      <van-tabbar-item icon="qr" to='/category'>分类</van-tabbar-item>
      <van-tabbar-item icon="shopping-cart-o" to="/buycart">购物车</van-tabbar-item>
      <van-tabbar-item icon="user-o" to='/PersonalCenter'>我的</van-tabbar-item>
    </van-tabbar>
</template>
<script>

export default {
    data:function(){
    return {
        tabActive:0
    }
  },
  mounted(){
       switch(this.$route.path){
            case "/PersonalCenter":
                this.tabActive=4
                break;
           case "/buycart":
                this.tabActive=3
                break;
            case "/category":
                this.tabActive=2
                break;
            case "/topic":
                this.tabActive=1
                break;
            case "/":
                this.tabActive=0
                break;    
            default:
                this.tabActive=0
          }
  }
}
</script>
